package com.msmall.community.convene.action.html;

import javax.servlet.http.HttpServletRequest;

import org.apache.tiles.AttributeContext;
import org.apache.tiles.context.TilesRequestContext;
import org.apache.tiles.preparer.ViewPreparer;

import com.msmall.base.pager.PaginationSupport;
import com.msmall.community.ApplicationManager;
import com.msmall.community.convene.model.Convene;
import com.msmall.community.convene.service.ConveneManager;

public class ConvenePreparer implements ViewPreparer{
	public void execute(TilesRequestContext tilesContext, AttributeContext context) {
		HttpServletRequest request = (HttpServletRequest) tilesContext.getRequest();
		ConveneManager cm = (ConveneManager) ApplicationManager.appContext.getBean("conveneManager");
		PaginationSupport page = new PaginationSupport();
		page.setClazz(Convene.class);
		page.setOrderBy("createTime");
		page.setOrder("DESC");
		page.setPageSize(10);
		cm.getPagination(page);
		request.setAttribute("conveneList", page.getItems());
	}

}
